package com.pig4cloud.pigx.contract.api.v1.controller;

import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.customize.api.annotation.OpenApi;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
import com.pig4cloud.pigx.contract.api.v1.service.PositionMarginDetailServiceV1;
import com.pig4cloud.pigx.contract.open.api.vo.OpenApiPositionMarginDetailVOV1;
import com.pig4cloud.pigx.user.enums.UserApiKeyEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 开放API - 仓位保证金明细 - v1版本
 *
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/contract/position/margin" )
@Api(value = "api_position_margin_v1", tags = "开放api-仓位保证金明细")
public class PositionMarginDetailControllerV1 {

	private final PositionMarginDetailServiceV1 service;

	/**
	 * 根据仓位id获取保证金调整历史
	 * @param positionId 仓位id
	 * @return list
	 */
	@ApiOperation(value = "根据仓位id获取保证金调整历史", notes = "根据仓位id获取保证金调整历史")
	@SysLog("根据仓位id获取保证金调整历史" )
	@OpenApi(version = "1",permission = UserApiKeyEnum.Permission.READ,needSignature = true)
	@GetMapping("/list")
	public R<List<OpenApiPositionMarginDetailVOV1>> getList(@RequestParam("positionId") Long positionId) {
		return service.getList(positionId);
	}

}
